package com.dg11185.nearshop.net.request;

import com.dg11185.libs.network.http.client.HttpRequest;
import com.dg11185.libs.utils.MD5.MD5Utils;
import com.dg11185.nearshop.app.Constants;
import com.dg11185.nearshop.net.response.ActivableResponse;

/**
 * 可激活检测请求
 * 
 * @author LWL_Private
 * @date 2014-05-22
 */
public class ActivableRequest extends HttpRequest<ActivableResponse> {

	public final static String sendVc = "sendVc";

	public ActivableRequest(String cardFaceNo, String mobilePhone) {
		super(Constants.ADDRESS, Constants.activable);
		addParam("cardFaceNo", cardFaceNo);
		addParam("mobilePhone", mobilePhone);
		addParam("chshToken", Constants.TOKEN);
	}

	public ActivableRequest add(String key, String value) {
		addParam(key, value);
		return this;
	}

	public ActivableRequest encryption() {
		addParam("chshSign", MD5Utils.getMD5Str(getParams(), Constants.MD5_key));
		return this;
	}

	@Override
	protected ActivableResponse parseJson(String response) throws Exception {
		ActivableResponse res = new ActivableResponse();
		res.parseJson(response);
		return res;
	}

}
